"""
浏览一个需要登录才能看到的url
1）请求头包含cookie信息
    F12——network 找到请求头user-agent,cookie
2）cookie参数
"""

import requests

url = 'https://gitee.com/zhou-poetry-and-painting/dashboard/projects'
#1)从浏览器拷贝，构造包含user-agent,cookie的请求头
h = {
 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
headers = {
  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
  'Cookie': 'user_locale=zh-CN; oschina_new_user=false; tz=Asia%2FShanghai; Hm_lvt_24f17767262929947cc3631f99bfd274=1605774978; sajssdk_2015_cross_new_user=1; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%228082191%22%2C%22first_id%22%3A%22175dfa5ac86a40-00c74c04fef977-930346c-2073600-175dfa5ac878e0%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%22175dfa5ac86a40-00c74c04fef977-930346c-2073600-175dfa5ac878e0%22%7D; Hm_lpvt_24f17767262929947cc3631f99bfd274=1605775029; gitee-session-n=K3V1bmlkR1N0SEFsaC96UWljTU5QQ0JJRG13SVpkR1VUWFdpeis2Lzc4dnJwc0VOZWxmWnlBcVRmc0pnWDF2WDFEUW9KMzh3Mk1QaDVEaEVxWUh2WVlsREF3TnZDNXJLU0V3RHh4YmNHQ1VIUkgrMTNUeEJDU2czM1ZVMzNzaHlyK2h1SWM1Y3dvMjBEamt3RjR4aGJGa2p4TkYvVmVVYnEwVy8weUJxT2g4OGlLT2ZlS3RlOVVlUlQrL3Z0WHRSUUZTUFZndCs2VEVUejZIVGZkWndxNEJsUjliV0h1MDlHYmxLZC9mNjB3ZVIxNlc4NjZPSWtXNmZkL0ZJYmo5bFM3NkEzYU5ZazFBa3RITms4M3p4MWJOeFlhN3pUekkzOVRmdFNGWGpLTmhUSzdZOHZZTnkzMWVEdll5K0RhNGtUWDRVeFNEemZYam8vSUR6WnJUNDE5bDIxWUZjOG5qTFpQWXQySjBlTnhrPS0tdUVCMC9JMUJ6aDJwY3RqNC9ianNxZz09--7046c442e1bcae43a128b9e963ec86b002c3d6ab'
}

response1 = requests.get(url,headers=h)
print(response1.content.decode())

response2 = requests.get(url,headers=h)
print(response2.content.decode())















